#include "MatrixObject.h"
#include "Tensor.h"
#include "Factorization.h"
int main()
{


	MatrixObject F(2,1);
	MatrixObject G(2,1);
	MatrixObject H(2,1);
	Tensor t3(2);
	F.setElement(0,0,0.5);
	F.setElement(1,0,0.5);

	G.setElement(0,0,0.5);
	G.setElement(1,0,0.5);
	
	H.setElement(0,0,0.5);
	H.setElement(1,0,0.5);
	

	//t3.setElement(0,0,0,0);
	t3.setElement(0,0,1,0.1);
	t3.setElement(0,1,0,0.1);
	//t3.setElement(0,1,1,0);
	t3.setElement(1,0,0,0.1);
	//t3.setElement(1,0,1,0);
	//t3.setElement(1,1,0,0);
	t3.setElement(1,1,1,0.3);
	//cout<<t3.theTensor.size();
	t3.Output();
	cout<<endl<<endl;

	Factorization::NTF(t3,F,G,H,10);

	F.Output();cout<<endl<<endl;
	G.Output();cout<<endl<<endl;
	H.Output();cout<<endl<<endl;

//	SparseMatrix X1=t3.matricification(1);
//
//
//	MatrixObject temp1 = X1.s_n(H,G);
//	SparseMatrix temp2 = X1.WeightedElementwiseProduct(F,H,G);
//	MatrixObject temp3 = temp2.s_n(H,G);
//
//	F=F.elementwiseProduct(temp1.elementwiseDivision(temp3));
//	//check1(F);
//	//cout<<"On the "<<count<<" Iteration F = ";
//	F.Output();
//	cout<<"\n";

	//SparseMatrix tmp=t3.matricification(3);
	
	//tmp.Output();
	//SparseMatrix tmp=t.WeightedElementwiseProduct(F,G,H);
//tmp.Output();

//MatrixObject tmp2=tmp.s_n(G,H);
////SparseMatrix tmp2=tmp.WeightedElementwiseProduct(F,G,H);
//cout<<endl<<endl;
//tmp2.Output();
}